package com.zst.demo3.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zst.demo3.mapper.RolePermissionMapper;
import com.zst.demo3.po.RolePermissionPO;
import com.zst.demo3.service.IRolePermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
@Slf4j
public class RolePermissionServiceImpl implements IRolePermissionService {
    @Autowired
    RolePermissionMapper rolePermissionMapper;

    @Override
    public Optional<List<RolePermissionPO>> getRolePermissionById(Long roleId) {
        LambdaQueryWrapper<RolePermissionPO> query = Wrappers.lambdaQuery();
        query.eq(RolePermissionPO::getRoleId, roleId);
        List<RolePermissionPO> rolePermissionPOList = rolePermissionMapper.selectList(query);
        return Optional.of(rolePermissionPOList);
    }
}
